<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php
/*   Description  of this file
 *    Author king-of-war
 *    Last Modified 2009-5-8
 *    This class designed  for the vote operation
 */

 /*
  * set vote diaplay
  */


/*
 * vote display begin
 */

 $root_path='./';
  include_once $root_path.'head.php';
 include_once $root_path.'smart.inc.php';
 include_once  $root_path.'admin/class/vote.class.php';
 include_once  $root_path.'admin/class/temp.class.php';
/*
* get vote set
*/
$demo=new temp($root_path);
$vote_id=$demo->xml_read('vote_num');
 
 $count=$vote_id;
 
 
$vote=new vote($root_path);
$a=$vote->vote_read($count,1);

/*
 * check count range
 */
 $topic=array();
$pass=array();

if(count($a)){

$topic['id']=$a[0]->get_id();
$pass=$vote->vote_display($topic['id'],1);
$topic['topic']=$a[0]->get_topic();

}
/*
 * vote add
 */
 $info='投票查看';

 if(!empty($_POST['Submit'])){

 if(!isset($vote_id))
    $vote_id=$_POST['vote_id'];
    $se_id=$_POST['se_id'];
 $line=	$vote->vote_add('',$se_id,$vote_id,'',2,1);
if($line){
$info= '投票成功';
}else{
$info= '投票失败';
}
 }

/*
 * set template
 */
  $smarty->assign('info',$info);
 $smarty->display('vote.html');

  include_once $root_path.'foot.php';

?>
